02. Load PCD
Header Text
Load PCD
ND313 C1 L4 A03 Load PCD - Concept
To first load up one of the car’s recorded pcd files, you will want to create a new point processor, similar to the one we created before in the
simpleHighway
function. This time however you will be using the pcl
PointXYZI
type, the "I" stands for intensity, which will now be an additional feature for each point in the cloud.
In
environment.cpp
you should create a new function called
CityBlock
that will be the same layout as the
simpleHighway
function. The arguments for
CityBlock
will be the same as
simpleHighway
, a reference to the pcl viewer.
Inside the new
CityBlock
function you will create a new point processor using a
PointXYZI
template argument. You will use the point processor to load one of the car’s point clouds and then use the
renderPointCloud
function to view it. Don't forget to call cityBlock now instead of
simpleHighway
in the
main
function. Check out the code below for reference.
All of the car’s pcd files are located in
src/sensors/data/pcd/data_1/
void cityBlock(pcl::visualization::PCLVisualizer::Ptr& viewer)
{
// ----------------------------------------------------
// -----Open 3D viewer and display City Block -----
// ----------------------------------------------------
ProcessPointClouds<pcl::PointXYZI>* pointProcessorI = new ProcessPointClouds<pcl::PointXYZI>();
pcl::PointCloud<pcl::PointXYZI>::Ptr inputCloud = pointProcessorI->loadPcd("../src/sensors/data/pcd/data_1/0000000000.pcd");
renderPointCloud(viewer,inputCloud,"inputCloud");
}
The image below is what the results of loading and running this look like, if the color is not specified in the
renderPointCloud
function argument, it will default to using the intensity color coding.
Looking around the pcd, you can see several cars parked along the sides of the road and a truck approaching to pass the ego car on the left side. Your goal will be to fit bounding boxes around these cars and the passing truck, so then your system could later use that information in its path planner, trying to avoid any collisions with those obstacles.
Load PCD
Instructions
- Create cityBlock function as shown above
-
Replace the
simpleHighway
call inmain
withcityBlock
- Compile/Run, The output will look like the image above
- Orbit and Zoom around the point cloud
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: react
- Opened files (when workspace is loaded): n/a
ND313 C1 L4 A06 Load PCD - Solution